<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/">

    <script type="text/javascript" src="resources/js/lib/jquery2.js"></script>
    <link rel="stylesheet" type="text/css" href="resources/css/admin/uploadify.css"/>
    <script type="text/javascript" src="resources/js/lib/core/jquery.uploadify.min.js"></script>
    <script src="resources/js/lib/sea.js"></script>
    <script type="text/javascript">
        seajs.config({
            base: "${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/resources/"
        });
        seajs.use(["css/admin/uploadify.css"]);
        $(function () {
            var ctx = $("#ctx");
            $("#attach").uploadify({
                swf: ctx.val() + "/resources/css/admin/uploadify.swf",
                fileTypeExts:"*.jpg; *.gif;*.png;*.doc;*.txt;*.xls;*.xlsx;*.rar;*.zip;*.pdf,*.flv;*.swf",
                uploader: ctx.val() + "/upload",
                fileObjName: "attach",
                auto: false,
                onUploadSuccess: function (file,data,response) {
                    alert("name="+file.name+" response="+response+" data="+data);
                }
            });
            $("#upload").click(function () {
                $("#attach").uploadify("upload", "*");
            });
        });

    </script>

</head>
<body>
此页面为测试使用

<input type="hidden" id="ctx" value="<%=request.getContextPath()%>"/>
<input type="file" name="attach" id="attach"/>
<input type="button" value="上传文件" id="upload"/>

</body>
</html>